<?php

namespace Home\Controller;

use Zend\View\Model\ViewModel;
use Mine\Controllers\MyAbstractController;
use Mine\Utils\Constant;
use Zend\Session\Container;

class HomeController extends MyAbstractController {
	protected $albumTable;
	protected $sessionLogin = NULL;
	public function __construct() {
		parent::__construct();
		$this->sessionLogin = new Container ( Constant::SS_LOGIN );
	}
	
	public function indexAction() {
		
		//var_dump($this->sessionLogin->email);
		return array (
				'welcome' => 'Hello Zend Framework 2.0 - By QHOnline.Info',
				//'albums' => $this->getAlbumTable ()->fetchAll () 
		);
	}
	public function productAction() {
		$this->sessionLogin->email = 'hoangkhoa9089@gmail.com';

		var_dump($this->sessionLogin->email);
		
		$this->layout ( 'layout/login' );
		return new ViewModel ( array (
				'product' => "hoangkhoa" 
		) );
	}
	public function getAlbumTable() {
		if (! $this->albumTable) {
			$sm = $this->getServiceLocator ();
			$this->albumTable = $sm->get ( 'Home\Model\AlbumTable' );
		}
		return $this->albumTable;
	}
}